package com.platform.system.service.impl;

import java.util.List;

import com.platform.common.annotation.DataScope;
import com.platform.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.platform.system.mapper.ProAddressMapper;
import com.platform.system.domain.ProAddress;
import com.platform.system.service.IProAddressService;

/**
 * 地址Service业务层处理
 *
 * @author platform
 * @date 2025-02-23
 */
@Service
public class ProAddressServiceImpl implements IProAddressService {
    @Autowired
    private ProAddressMapper proAddressMapper;

    /**
     * 查询地址
     *
     * @param id 地址主键
     * @return 地址
     */
    @Override
    public ProAddress selectProAddressById(Long id) {
        return proAddressMapper.selectProAddressById(id);
    }

    @Override
    public List<ProAddress> selectProAddressListAll(ProAddress proAddress) {
        return proAddressMapper.selectProAddressListAll(proAddress);
    }

    /**
     * 查询地址列表
     *
     * @param proAddress 地址
     * @return 地址
     */
    @Override
    @DataScope(deptAlias = "d", userAlias = "u")
    public List<ProAddress> selectProAddressList(ProAddress proAddress) {
        return proAddressMapper.selectProAddressList(proAddress);
    }

    /**
     * 新增地址
     *
     * @param proAddress 地址
     * @return 结果
     */
    @Override
    public int insertProAddress(ProAddress proAddress) {
        proAddress.setCreateTime(DateUtils.getNowDate());
        return proAddressMapper.insertProAddress(proAddress);
    }

    /**
     * 修改地址
     *
     * @param proAddress 地址
     * @return 结果
     */
    @Override
    public int updateProAddress(ProAddress proAddress) {
        proAddress.setUpdateTime(DateUtils.getNowDate());
        return proAddressMapper.updateProAddress(proAddress);
    }

    /**
     * 批量删除地址
     *
     * @param ids 需要删除的地址主键
     * @return 结果
     */
    @Override
    public int deleteProAddressByIds(Long[] ids) {
        return proAddressMapper.deleteProAddressByIds(ids);
    }

    /**
     * 删除地址信息
     *
     * @param id 地址主键
     * @return 结果
     */
    @Override
    public int deleteProAddressById(Long id) {
        return proAddressMapper.deleteProAddressById(id);
    }
}
